# Django框架导入
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path
from django.contrib.auth import views as auth_views

# 本地视图导入
from app.views import (
    # 用户认证相关
    user_login, user_logout, navigation,
    # 用户管理相关
    user_add, user_list, user_edit, toggle_user_active, reset_password,
    superuser_add, superuser_list,
    # 公司/部门管理
    supercompany_add, supercompany_list,
    superdepartment_add, superdepartment_list,
    department_add, department_list,
    # 物料管理相关
    factory_add, factory_list,
    technology_add, technology_list,
    materialtype_add, materialtype_list,
    warehouse_add, warehouse_list,
    place_add, place_list,
    material_add, material_list,
    # 库存管理相关
    inventoryrecord_add, pending_inventory_list, approve_inventory_record,
    inventory_record_list, inventoryhistory_list,
    # 设备管理相关
    device_adjust, pending_devicehistory, devicehistory_list,
    approve_device, device_detail, devicehistory_detail,
    device_edit, device_detail_pending, pendingdevicehistory_detail,
    # 导出功能
    export_inventory, export_device, export_inventoryrecord, export_devicehistory,
    # 帮助页面
    help_page,
    # 类视图
    InventoryListView, DeviceListView, DeviceCreateView,
    feature_not_available
)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('login/', user_login, name='login'),
    path('logout/', user_logout, name='logout'),
    path('navigation/', navigation, name='navigation'),
    path('system/user_list/', user_list, name='user_list'),
    path('system/superuser_list/', superuser_list, name='superuser_list'),
    path('system/user_add/', user_add, name='user_add'),
    path('super/company/add/', supercompany_add, name='supercompany_add'),
    path('super/department/add/', superdepartment_add, name='superdepartment_add'),
    path('super/user/add/', superuser_add, name='superuser_add'),
    path('password_change/', auth_views.PasswordChangeView.as_view(template_name='password_change.html'), name='password_change'),
    path('password_change/done/', auth_views.PasswordChangeDoneView.as_view(template_name='password_change_done.html'), name='password_change_done'),
    path('system/department_add/', department_add, name='department_add'),
    path('system/department_list/', department_list, name='department_list'),
    path('system/supercompany/list/',supercompany_list, name='supercompany_list'),
    path('system/superdepartment/list/', superdepartment_list, name='superdepartment_list'),
    path('system/factory_add/', factory_add, name='factory_add'),
    path('system/factory_list/', factory_list, name='factory_list'),
    path('system/technology_add/', technology_add, name='technology_add'),
    path('system/technology_list/', technology_list, name='technology_list'),
    path('system/materialtype_add/', materialtype_add, name='materialtype_add'),
    path('system/materialtype_list/', materialtype_list, name='materialtype_list'),
    path('system/warehouse_add/', warehouse_add, name='warehouse_add'),
    path('system/warehouse_list/', warehouse_list, name='warehouse_list'),
    path('system/place_add/', place_add, name='place_add'),
    path('system/place_list/', place_list, name='place_list'),
    path('system/material_add/', material_add, name='material_add'),
    path('system/material_list/', material_list, name='material_list'),
    path('inventory/inventory_list/', InventoryListView.as_view(), name='inventory_list'),
    path('device/device_list/', DeviceListView.as_view(), name='device_list'),
    path('device/device_create/', DeviceCreateView.as_view(), name='device_create'),
    path('system/reset_password/<int:user_id>/', reset_password, name='reset_password'),
    path('system/toggle_active/<int:user_id>/', toggle_user_active, name='toggle_user_active'),
    path('system/user_edit/<int:user_id>/', user_edit, name='user_edit'),
    path('system/export_inventory/', export_inventory, name='export_inventory'),
    path('system/export_inventoryrecord/', export_inventoryrecord, name='export_inventoryrecord'),
    path('system/export_device/', export_device, name='export_device'),
    path('system/export_devicehistory/', export_devicehistory, name='export_devicehistory'),
    path('inventory/inventoryrecord_add/<int:inventory_id>/', inventoryrecord_add, name='inventoryrecord_add'),
    path('inventory/pending_list/', pending_inventory_list, name='pending_inventory_list'),
    path('inventory/approve/<int:record_id>/', approve_inventory_record, name='approve_inventory_record'),
    path('inventory/records/', inventory_record_list, name='inventory_record_list'),
    path('inventory/history/<int:inventory_id>/', inventoryhistory_list, name='inventoryhistory_list'),
    path('device/device_adjust/<int:pk>/', device_adjust, name='device_adjust'),
    path('device/pending_devicehistory/', pending_devicehistory, name='pending_devicehistory'),
    path('device/devicehistory/', devicehistory_list, name='devicehistory_list'),
    path('device/approve_device/<int:pk>/', approve_device, name='approve_device'),
    path('device/device_detail/<int:device_id>/', device_detail, name='device_detail'),
    path('device/devicehistory_detail/<int:device_number>/', devicehistory_detail, name='devicehistory_detail'),
    path('device/edit/<int:device_id>/', device_edit, name='device_edit'),
    path('device/detail_pending/<str:number>/', device_detail_pending, name='device_detail_pending'),
    path('device/pendingdevicehistory/detail/<str:number>/', pendingdevicehistory_detail, name='pendingdevicehistory_detail'),
    path('help_page/', help_page, name='help_page'),
    path('feature_not_available/', feature_not_available, name='feature_not_available'),
    
]
    